package com.erlinyou.im.model.chat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.asm.Type;
import org.springframework.cglib.core.CodeEmitter;
import org.springframework.cglib.core.HashCodeCustomizer;

import com.erlinyou.im.model.base.AbstractDO;

/**
 * 聊天消息体
 * @author Administrator
 *
 */
@Entity
@Table(name = "tchat_message")
public class ChatMessage extends AbstractDO{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 
	 */
	@Id
	private String id;
	/**
	 * 发送人
	 */
	private Long fromId;
	/**
	 * 接收人
	 */
	private Long toId;
	/**
	 * 消息类型
	 * 1	普通消息
	 * 2	发送图片
	 * 3	发送视频
	 * 4	发送语音
	 * 5	发送文件
	 * 6	语音聊天
	 * 7	视频聊天
	 * 10        系统消息
	 */
	private int type;
	/**
	 * 聊天类型
	 * 1	单聊
	 * 2	群聊
	 */
	private int ctype;
	/**
	 * 消息内容
	 */
	@Column(columnDefinition="text")
	private String content;
	/**
	 * 创建时间
	 */
	private long ct;
	/**
	 * 组ID
	 */
	private String gid;
	/**
	 * 客户端ID
	 */
	private String clientid;
	/**
	 * 是否撤回
	 * 1	撤回
	 * 0	未撤回
	 */
	private int rev;
	/**
	 * 回复人
	 */
	private Long visitorId;
	
	
	public Long getVisitorId() {
		return visitorId;
	}
	public void setVisitorId(Long visitorId) {
		this.visitorId = visitorId;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	public Long getFromId() {
		return fromId;
	}
	public void setFromId(Long fromId) {
		this.fromId = fromId;
	}
	public Long getToId() {
		return toId;
	}
	public void setToId(Long toId) {
		this.toId = toId;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public long getCt() {
		return ct;
	}
	public void setCt(long ct) {
		this.ct = ct;
	}
	public String getGid() {
		return gid;
	}
	public void setGid(String gid) {
		this.gid = gid;
	}
	public String getClientid() {
		return clientid;
	}
	public void setClientid(String clientid) {
		this.clientid = clientid;
	}
	public int getRev() {
		return rev;
	}
	public void setRev(int rev) {
		this.rev = rev;
	}
	public int getCtype() {
		return ctype;
	}
	public void setCtype(int ctype) {
		this.ctype = ctype;
	}
	
	@Override
	  public boolean equals(Object obj) {
	      if (this.getId().equals(((ChatMessage) obj).getId())) {
	          return true;
	      }
	      return false;
	  }
}
